package com.topwalk.datacollect;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

import com.topwalk.datacollect.config.ApplicationConfig;
import com.topwalk.datacollect.server.SysLogCollectionServer;
import com.topwalk.datacollect.util.SocketCP;

//@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@SpringBootApplication
public class Application implements ApplicationRunner {

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

	/**
	 * 程序初始化
	 */
	@Override
	public void run(ApplicationArguments args) throws Exception {

		// 初始化高频数据的socket连接池
		SocketCP.create(
				ApplicationConfig.INC_SOCKET_IP,
				ApplicationConfig.INC_SOCKET_PORT,
				ApplicationConfig.INC_SOCKET_POOL_SIZE);
		// 初始化低频数据的socket连接池
//		SocketCP.create(
//				ApplicationConfig.SYNC_SOCKET_IP,
//				ApplicationConfig.SYNC_SOCKET_PORT,
//				ApplicationConfig.SYNC_SOCKET_POOL_SIZE);

		// 读取事件日志字段信息
		SysLogCollectionServer.readCsv("source_apt_log");
		SysLogCollectionServer.readCsv("source_aptt_log");
		SysLogCollectionServer.readCsv("source_bljdl_log");
		SysLogCollectionServer.readCsv("source_fw_log");
		SysLogCollectionServer.readCsv("source_gjrz_log");
		SysLogCollectionServer.readCsv("source_ids_log");
		SysLogCollectionServer.readCsv("source_ivas_log");
		SysLogCollectionServer.readCsv("source_jgxxrz_log");
		SysLogCollectionServer.readCsv("source_rwrz_log");
		SysLogCollectionServer.readCsv("source_srsq_log");
		SysLogCollectionServer.readCsv("source_unmsyslog_log");
		SysLogCollectionServer.readCsv("source_waf_log");
		SysLogCollectionServer.readCsv("source_wlsb_log");
		SysLogCollectionServer.readCsv("source_xtczrz_log");
		SysLogCollectionServer.readCsv("source_xtgjrz_log");
		SysLogCollectionServer.readCsv("source_ywcz_log");
		SysLogCollectionServer.readCsv("source_zcdl_log");
		SysLogCollectionServer.readCsv("source_zjrz_log");
		// 启动syslog服务
//		SysLogCollectionServer.getSysLog();

	}

}

